﻿// LightNet - Lightweight .NET Framework
// Copyright (c) 2010 http://lightnet.codeplex.com

namespace System
{
    using System.Runtime.InteropServices;
    using System.Threading;

    /// <summary>
    /// Represents the status of an asynchronous operation.
    /// </summary>
    [ComVisible(true)]
    public interface IAsyncResult
    {
        /// <summary>
        /// Gets a user-defined object that qualifies or contains information about an asynchronous operation.
        /// </summary>
        /// <returns>A user-defined object that qualifies or contains information about an asynchronous operation.</returns>
        object AsyncState { get; }

        /// <summary>
        /// Gets a <see cref="T:System.Threading.WaitHandle" /> that is used to wait for an asynchronous operation to complete.
        /// </summary>
        /// <returns>A wait handle that is used to wait for an asynchronous operation to complete.</returns>
        WaitHandle AsyncWaitHandle { get; }

        /// <summary>
        /// Gets a value that indicates whether the asynchronous operation completed synchronously.
        /// </summary>
        /// <returns>true if the asynchronous operation completed synchronously; otherwise, false.</returns>
        bool CompletedSynchronously { get; }

        /// <summary>
        /// Gets a value that indicates whether the asynchronous operation has completed.
        /// </summary>
        /// <returns>true if the operation is complete; otherwise, false.</returns>
        bool IsCompleted { get; }
    }
}
